<template>
  <BaseCard class="h-full">
    <template #header>
      <div class="flex justify-between">
        <span class="title">政策文件</span>
        <el-button type="primary" size="small" @click="gotoMore">更多</el-button>
      </div>
    </template>
    <div class="list-wrap">
      <div class="head flex">
        <div class="flex-1" >标题</div>
        <div>发布时间</div>
      </div>
      <div class="list-items">
        <div class="item flex" v-for="item in policyList">
          <div class="flex-1 truncate" @click="downloadMet(item.fileId)">
            {{item.fileName.substring(0,item.fileName.lastIndexOf('.'))}}
          </div>
          <div>{{item.uploadTime}}</div>
        </div>
      </div>
    </div>
  </BaseCard>
</template>

<script setup>
import BaseCard from "./BaseCard.vue";
import * as homeApi  from "@/api/home/index";
const { proxy } = getCurrentInstance();
const router = useRouter();
const  policyList=ref([])
const queryParam=reactive({
    pageNum: 1,
    pageSize: 6,
    categoryId: undefined,
    fileId: undefined,
    fileName:undefined,
    id: undefined,
    note: 6,
    categoryId: undefined,
    uploadPersonId: undefined,
    uploadPersonName: undefined,
})
onMounted(async() => {

let  res  =  await homeApi.getFileShareList(queryParam);
if(res){
  policyList.value=res.rows
  console.log("policyList",policyList.value)
}
  
  
})
const gotoMore=()=>{
      const obj = { path: "/home/policyList/", name: "policyList" };
      router.push(obj)

}

const downloadMet = (i) => {
    proxy.$download.common(i)
}
</script>

<style scoped lang="scss">
@import url("../index.scss");
</style>
